package com.apes.fn.mdm.paint;

import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface PaintBusinessScopeRepository extends CustomRepository<PaintBusinessScope, String> {

    @Query("select p from PaintBusinessScope p where p.dept.id = :deptId and instr( :classifyId , p.classify.id) >= 1 and p.supplier.party.id != p.company.party.id")
    List<PaintBusinessScope> findByDeptAndClassify(@Param("deptId") String deptId, @Param("classifyId") String classifyId);

    @Query("select p from PaintBusinessScope p where p.dept.id = :deptId and instr( :classifyId , p.classify.id) >= 1")
    List<PaintBusinessScope> findByDeptIdAndClassifyId(@Param("deptId") String deptId, @Param("classifyId") String classifyId);

    @Query("select p from PaintBusinessScope p where p.dept.id = :deptId ")
    List<PaintBusinessScope> findByDept(@Param("deptId") String deptId);

}
